package cn.wolfcode.wolf2w.controller;



import cn.wolfcode.wolf2w.domain.*;
import cn.wolfcode.wolf2w.service.*;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("destinations")
public class DestinationContorller {

    @Autowired
    private IRegionService regionService;
    @Autowired
    private IDestinationService destinationService;
    @Autowired
    private IStrategyCatalogService strategyCatalogService;
    @Autowired
    private IStrategyService strategyService;
    @Autowired
    private ITravelService travelService;

    //热门区域
    @GetMapping("/hotRegion")
    public Object hotRegion(){
        List<Region> list = regionService.queryHotRegions();
        return JsonResult.success(list);
    }

    @GetMapping("/list")
    public Object list(){
        return JsonResult.success(destinationService.list());
    }

    //热门区域目的地
    @GetMapping("/search")
    public Object search(String regionId){
        List<Destination> list = destinationService.getDestByRegionIdForApi(regionId);
        return JsonResult.success(list);
    }

    //目的地下攻略分类
    @GetMapping("/catalogs")
    public Object catalogs(String destId){

        List<StrategyCatalog> list = strategyCatalogService.queryCatalogByDestId(destId);
        return JsonResult.success(list);
    }

    //页面导航吐司
    @GetMapping("/toasts")
    public Object toasts (String destId){
        List<Destination> list = destinationService.queryToastByParentId(destId);
        return JsonResult.success(list);
    }

    //显示浏览量前三文章
    @GetMapping("/strategies/viewnumTop3")
    public Object strategyiesViewnumTop3(String destId){
        List<Strategy> list = strategyService.queryViewnumTop3(destId);
        return JsonResult.success(list);
    }
    @GetMapping("/travels/viewnumTop3")
    public Object travelsViewnumTop3(String destId){
        List<Travel> list = travelService.queryViewnumTop3(destId);
        return JsonResult.success(list);
    }
}
